﻿using Terraria;
using Terraria.DataStructures;
using WorseGame.Common.Cores.Custom.Interfaces;

namespace WorseGame.Common.Cores.CustomCatchRules.Conditions
{
    public class HeightLevelCondition(int heightLevel, bool? lessOrEqualOrGreater) : ICatchCondition {
        private readonly int _heightLevel = heightLevel;
        private readonly bool? _lessOrEqualOrGreater = lessOrEqualOrGreater;

        public bool IsConditionMet(FishingAttempt attempt, Projectile bobber) {
            return _lessOrEqualOrGreater switch
            {
                false => attempt.heightLevel <= _heightLevel,
                null => attempt.heightLevel == _heightLevel,
                _ => attempt.heightLevel >= _heightLevel,
            };
        }
    }
}